package org.example.wax.component;

import com.alibaba.fastjson.JSON;
import org.example.wax.manager.CabinetManager;
import org.example.wax.properties.CabinetProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class CommandLineRunnerImpl implements CommandLineRunner {

    @Autowired
    private CabinetProperties cabinetProperties;

    @Override
    public void run(String... args) throws Exception {
        System.out.println(JSON.toJSONString(cabinetProperties));
        CabinetManager.getInstance().initCabinet(cabinetProperties);
        CabinetManager.getInstance().connectReader();
        CabinetManager.getInstance().connectLockControl();
    }
}
